<?php

require_once APPLICATION_PATH . '/admin/forms/User.php';

class User_Form extends Admin_Form_User
{
    /**
     * Initialize the form
     *
     * @return void
     */

    public function onlyRegistrationActionElements($attribs = array())
    {
        // remove unwanted elements
        $this->removeElement('openid');
        $this->removeElement('active');
        $this->removeElement('role');
        $this->removeElement('password');
        $this->removeElement('password_confirm');
        $this->removeElement('update_password');

        if (isset($attribs['legend'])) {
            $this->_setLegend($attribs['legend']);
        }
    }

    public function onlyNewpasswordActionElements($attribs = array())
    {
        // remove unwanted elements
        $this->removeElement('first_name');
        $this->removeElement('last_name');
        $this->removeElement('openid');
        $this->removeElement('active');
        $this->removeElement('role');
        $this->removeElement('password');
        $this->removeElement('password_confirm');
        $this->removeElement('update_password');

        if (isset($attribs['legend'])) {
            $this->_setLegend($attribs['legend']);
        }
    }

    public function onlyChangepasswordActionElements($attribs = array())
    {
        // remove unwanted elements
        $this->removeElement('first_name');
        $this->removeElement('last_name');
        $this->removeElement('openid');
        $this->removeElement('active');
        $this->removeElement('role');
        $this->removeElement('email');
        $this->removeElement('update_password');
        $this->removeElement('captcha');

        if (isset($attribs['legend'])) {
            $this->_setLegend($attribs['legend']);
        }
    }

    protected function _setLegend($legend)
    {
        $group = $this->getDisplayGroup('adminUserGroup');
        $group->setLegend($legend);
    }
}